package com.hmall.user.mapper;

import com.hmall.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Update;

public interface UserMapper extends BaseMapper<User> {
    /**
     * 下单扣款
     * @param userId
     * @param money
     */
    @Update("update tb_user set balance = balance - #{money} where id = #{userId}")
    void deduct(Long userId, Long money);

    /**
     * 回滚金额
     * @param userId
     * @param money
     */
    @Update("update tb_user set balance = balance + #{money} where id = #{userId}")
    void refund(String userId, String money);
}